<?php
class CollectionModel
{

    public function __construct()
    {
		$this->db = Yaf_Registry::get('db');
    }
   
    /*public function selectPushInfoByTime()
    {
        $sql="select * from article where status='2' and push_time=''";
        return  $this->db->query($sql);
    }*/

    public function selectCollInfoByTime($info)
    {
        date_default_timezone_set('PRC');
        
        foreach ($info as $key => $value) {
            $next_day = strtotime($value) + 3600*24;
            $sql="select count(status) as counts from article where  `create_time`>UNIX_TIMESTAMP('{$value}') and `create_time`< '$next_day'  ";
            $result[$key] = $this->db->query($sql);
           // var_dump($sql);
        }
        return $result;
    }

    public function selectCollErrorInfoByTime($info)
    {
        date_default_timezone_set('PRC');
        
        foreach ($info as $key => $value) {
            $next_day = strtotime($value) + 3600*24;
            $sql="select count(level) as counts from collection_log where level='0' and `start_time`>UNIX_TIMESTAMP('{$value}') and `start_time`< '$next_day'  ";
            $result[$key] = $this->db->query($sql);
           // var_dump($sql);
        }
        return $result;
    }
}